/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Report.java
 *
 * Created on May 19, 2010, 9:43:12 PM
 */
package com.aptech.campaign.ui;

import com.aptech.campaign.biz.ReportBiz;
import com.aptech.campaign.component.ReportManager;
import com.aptech.campaign.entities.Report;
import java.sql.Date;
import java.util.ArrayList;

/**
 *
 * @author Tai Nguyen
 */
public class ReportFrm extends javax.swing.JFrame {

    /** Creates new form Report */
    CampaignMainFrm main;

    public ReportFrm(Date firstDate, Date secondDate) {
        initComponents();
        setLocationRelativeTo(main);
        ReportManager report = new ReportManager();
        ReportBiz rebuz = new ReportBiz();
        ArrayList<Report> arr = rebuz.findByDate(firstDate, secondDate);
        this.reportPnl.add(report.getEnumerationViewer(arr, true));
        this.setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        txfDate1 = new javax.swing.JTextField();
        txfDate2 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        reportPnl = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Report");
        getContentPane().setLayout(new java.awt.GridBagLayout());

        jPanel1.setLayout(new java.awt.GridBagLayout());

        txfDate1.setEditable(false);
        txfDate1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txfDate1ActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 18);
        jPanel1.add(txfDate1, gridBagConstraints);

        txfDate2.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        jPanel1.add(txfDate2, gridBagConstraints);

        jLabel1.setText("Date From : ");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 18);
        jPanel1.add(jLabel1, gridBagConstraints);

        jLabel2.setText("To: ");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 18);
        jPanel1.add(jLabel2, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 255;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 0.1;
        getContentPane().add(jPanel1, gridBagConstraints);

        reportPnl.setLayout(new java.awt.BorderLayout());
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 100;
        gridBagConstraints.ipady = 100;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 0.9;
        getContentPane().add(reportPnl, gridBagConstraints);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txfDate1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txfDate1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txfDate1ActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//
//               ReportFrm re;
//               
//                re = new ReportFrm(re.txfDate1).setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel reportPnl;
    public javax.swing.JTextField txfDate1;
    public javax.swing.JTextField txfDate2;
    // End of variables declaration//GEN-END:variables
}
